// 48.旋转图像
package LeetcodeHot100;

public class Solution048 {

  public void rotate(int[][] matrix) {
    int n = matrix.length;
    for (int i = 0; i < n / 2; i++) {
      for (int j = i; j <= n - 2 - i; j++) {
        int row = i;
        int column = j;
        int temp = matrix[row][column];
        for (int k = 0; k < 3; k++) {
          matrix[row][column] = matrix[n - 1 - column][row];
          int t = row;
          row = n - 1 - column;
          column = t;
        }
        matrix[row][column] = temp;
      }
    }
  }
}
